home *** CD-ROM | disk | FTP | other *** search
/ Game.EXE 2001 January / execd1200.iso / Shareware / Blocks 3 / setup.exe / Source / DARK.C < prev    next >
Encoding:
C/C++ Source or Header  |  2000-10-06  |  785 b   |  40 lines

  1. #include <allegro.h>
  2. #include <jgmod.h>
  3. #include <blocks3.h>
  4.  
  5. void Map_Darkness(void)
  6. {
  7.  int i, j;
  8.  
  9.  for (i = 0; i < 25; i++)
  10.  for (j = 0; j < 15; j++)
  11.  map_dark[i][j] = 0;
  12.  
  13.  Add_Dark_Grad(ply[0].x/32, ply[0].y/32);
  14.  
  15.  for (i = 0; i < 25; i++)
  16.  for (j = 0; j < 15; j++)
  17.  if (map_dark[i][j] > 5) map_dark[i][j] = 5;
  18. }
  19.  
  20. void Add_Dark_Grad(int x, int y)
  21. {
  22.  map_dark[x][y] +=3;
  23.  
  24.  map_dark[x][y - 1] +=2;
  25.  map_dark[x + 1][y] +=2;
  26.  map_dark[x][y + 1] +=2;
  27.  map_dark[x - 1][y] +=2;
  28.  
  29.  map_dark[x][y - 2] +=1;
  30.  map_dark[x + 1][y - 1] +=1;
  31.  map_dark[x + 2][y] +=1;
  32.  map_dark[x + 1][y + 1] +=1;
  33.  map_dark[x][y + 2] +=1;
  34.  map_dark[x + 1][y - 1] +=1;
  35.  map_dark[x - 2][y] +=1;
  36.  map_dark[x - 1][y - 1] +=1;
  37.  
  38.  DirtyList((x-2)*32, (y-2)*32, 0, 160, 160, blank);
  39. }
  40.